# 项目基础配置
ALLOWED_HOSTS = ['*']
DEBUG = True

# 缓存
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://192.168.20.234:6379/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            # "CONNECTION_POOL_KWARGS": {"max_connections": 100},
            # "PASSWORD": "密码",
            # "DECODE_RESPONSES": True
        }
    },
}

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": [("192.168.20.234", 6379)],
            "capacity": 1000,
            "expiry": 120,
        },
    },
}

# 数据库
DATABASES = {
    'default': {
        'ATOMIC_REQUESTS': True,
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'django_devops',
        'USER': 'devops',
        'PASSWORD': 'devops123',
        'PORT': 8992,
        'HOST': '192.168.20.234',
        # 添加以下代码,取消外键检查
        'OPTIONS': {
            'charset': 'utf8mb4',
            'sql_mode': 'STRICT_TRANS_TABLES',
            "init_command": "SET foreign_key_checks = 0;",
        }
    }
}